﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace graphicsdemo
{
    public class Factory
    {
        public static Graphics GetGraphics(string arg)
        {
            double s = new Random().NextDouble();
            double h = new Random().NextDouble();
            Graphics graphics = null;
            if (arg.Equals("Circle"))
                graphics = new Circle(s);
            else if (arg.Equals("Square"))
                graphics = new Square(s);
            else if (arg.Equals("Triangle"))
                graphics = new Triangle(s, h);
            else if (arg.Equals("Rectangle"))
                graphics = new Rectangle(s, h);
            return graphics;
        }
        public static Graphics GetRandomGraphics()
        {
            string[] gra = { "Circle", "Square", "Triangle", "Rectangle" };
            return GetGraphics(gra[new Random().Next(gra.Length)]);
        }
    }
}
